import React, { Component } from 'react'

const DetailData = [
      {id:'01',content:'你好北京'},
      {id:'02',content:'你好尚硅谷'},
      {id:'03',content:'你好黑马'}
]  

export default class Detail extends Component {
  render() {
    console.log(this.props);
    
    const {id,title} = this.props.match.params; //接收params参数
    const findRes = DetailData.find((DetailObj)=>{
      return DetailObj.id === id;
    }) || {}
    
    return (
      <div>
        <ul>
          <li>ID:{id}</li>
          <li>TITLE:{title}</li>
          <li>CONTENT:{findRes.content}</li>
        </ul>
      </div>
    )
  }
}
